from django.db import models


# Create your models here.
class ClassRoom(models.Model):
    order = models.PositiveIntegerField(verbose_name='教室序号')
    name = models.CharField(max_length=100, verbose_name='教室名')  # 名称
    number_of_people = models.IntegerField(verbose_name='人数')  # 人数
    is_theory_teacher = models.BooleanField(verbose_name='是否为理论教室')
    image = models.ImageField(upload_to='img/Cmg/', verbose_name='教室图片')

    class Meta:
        verbose_name_plural = '教室信息'

    def __str__(self):
        return f'{self.name}'


class Device(models.Model):
    number = models.IntegerField(verbose_name='序号')  # 序号
    name = models.CharField(max_length=100, verbose_name='名称')  # 名称
    price = models.FloatField(verbose_name='金额')  # 金额
    time = models.DateTimeField(verbose_name='时间')  # 时间
    image = models.ImageField(upload_to='img/Dmg/', verbose_name='设备图片')  # 设备图片
    status = models.CharField(max_length=20, verbose_name='当前状态',null=True)  # 当前状态
    teacher = models.ForeignKey(to='ClassRoom', on_delete=models.CASCADE, verbose_name='对应教室')  # 所属教室

    class Meta:
        verbose_name_plural = '设备信息'

    def __str__(self):
        return f'{self.name}'


class Hygiene(models.Model):
    RATING_CHOICES = [
        ('1', '极差'),
        ('2', '差'),
        ('3', '一般'),
        ('4', '良好'),
        ('5', '优秀'),
    ]
    cleaner = models.CharField(max_length=100,verbose_name='清洁人员')  # 清洁人员
    classroom = models.ForeignKey('Classroom', on_delete=models.CASCADE,verbose_name='所属教室')  # 教室名
    status = models.CharField(choices=RATING_CHOICES,verbose_name='卫生情况',max_length=16)  # 卫生情况
    responsible_person = models.CharField(max_length=100,verbose_name='负责人')  # 负责人
    cleaning_time = models.DateTimeField(verbose_name='清洁时间')  # 清洁时间
    image = models.ImageField(upload_to='img/Hmg/',verbose_name='卫生图片')  # 卫生图片

    class Meta:
        verbose_name_plural = '卫生信息'

    def __str__(self):
        return f"{self.classroom}的卫生"
